package com.kexio.enterprise.governance.retry.statistics;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * 重试统计信息
 * 
 * @author Kexio
 * @since 1.0.0
 */
public class RetryStatistics {
    private String key;
    private long totalExecutions;
    private long successfulExecutions;
    private long failedExecutions;
    private long totalRetries;
    private double successRate;
    private double averageAttempts;
    private double averageExecutionTime;
    private long maxExecutionTime;
    private long minExecutionTime;
    private long maxAttempts;
    private Map<String, Long> exceptionStats; // 异常类型统计
    private Map<Integer, Long> attemptDistribution; // 尝试次数分布
    private LocalDateTime startTime;
    private LocalDateTime lastExecutionTime;

    // Getters and Setters
    public String getKey() { return key; }
    public void setKey(String key) { this.key = key; }
    
    public long getTotalExecutions() { return totalExecutions; }
    public void setTotalExecutions(long totalExecutions) { this.totalExecutions = totalExecutions; }
    
    public long getSuccessfulExecutions() { return successfulExecutions; }
    public void setSuccessfulExecutions(long successfulExecutions) { this.successfulExecutions = successfulExecutions; }
    
    public long getFailedExecutions() { return failedExecutions; }
    public void setFailedExecutions(long failedExecutions) { this.failedExecutions = failedExecutions; }
    
    public long getTotalRetries() { return totalRetries; }
    public void setTotalRetries(long totalRetries) { this.totalRetries = totalRetries; }
    
    public double getSuccessRate() { return successRate; }
    public void setSuccessRate(double successRate) { this.successRate = successRate; }
    
    public double getAverageAttempts() { return averageAttempts; }
    public void setAverageAttempts(double averageAttempts) { this.averageAttempts = averageAttempts; }
    
    public double getAverageExecutionTime() { return averageExecutionTime; }
    public void setAverageExecutionTime(double averageExecutionTime) { this.averageExecutionTime = averageExecutionTime; }
    
    public long getMaxExecutionTime() { return maxExecutionTime; }
    public void setMaxExecutionTime(long maxExecutionTime) { this.maxExecutionTime = maxExecutionTime; }
    
    public long getMinExecutionTime() { return minExecutionTime; }
    public void setMinExecutionTime(long minExecutionTime) { this.minExecutionTime = minExecutionTime; }
    
    public long getMaxAttempts() { return maxAttempts; }
    public void setMaxAttempts(long maxAttempts) { this.maxAttempts = maxAttempts; }
    
    public Map<String, Long> getExceptionStats() { return exceptionStats; }
    public void setExceptionStats(Map<String, Long> exceptionStats) { this.exceptionStats = exceptionStats; }
    
    public Map<Integer, Long> getAttemptDistribution() { return attemptDistribution; }
    public void setAttemptDistribution(Map<Integer, Long> attemptDistribution) { this.attemptDistribution = attemptDistribution; }
    
    public LocalDateTime getStartTime() { return startTime; }
    public void setStartTime(LocalDateTime startTime) { this.startTime = startTime; }
    
    public LocalDateTime getLastExecutionTime() { return lastExecutionTime; }
    public void setLastExecutionTime(LocalDateTime lastExecutionTime) { this.lastExecutionTime = lastExecutionTime; }
}
